<nz-card nzTitle="基本信息">
    <div class="info-wrap">
        <div class="info-avatar">
            <dl class="info-avatar-dl">
                <dt>
                    <img nz-image [nzSrc]="detailsData?.userImg || fallback" alt="" />
                </dt>
                <!-- <dd>
                    <span class="info-values-sp">
                        <img class="img-icon" src="./assets/images/info-tree.png" width="18" height="18" />
                        {{ detailsData.growValue || '--' }}
                    </span>
                    <span class="info-values-sp">
                        <img class="img-icon" src="./assets/images/info-integral.png" width="18" height="18" />
                        {{ detailsData.integral || '--' }}
                    </span>
                </dd> -->
            </dl>
        </div>

        <div class="info-list p-t-5">
            <nz-descriptions
                [nzBordered]="false"
                nzSize="default"
                [nzColumn]="{ xxl: 4, xl: 3, lg: 3, md: 3, sm: 2, xs: 1 }">
                <nz-descriptions-item nzTitle="用户ID">{{ detailsData?.id || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="状态">
                    {{ state_To_text(detailsData?.status) }}
                </nz-descriptions-item>
                <nz-descriptions-item nzTitle="手机号码">{{ detailsData?.phone || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="微信openid">{{ detailsData?.openid || '-' }}</nz-descriptions-item>

                <nz-descriptions-item nzTitle="登录名">{{ detailsData?.username || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="注册时间">{{ detailsData?.regTime || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="渠道来源">{{ platform_to_text(detailsData?.platform) || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="渠道来源-活动">{{ detailsData?.cid == 1 ? ' -- 20210825注册168礼包活动' : '-' }}</nz-descriptions-item>

                <nz-descriptions-item nzTitle="用户初始身份">{{ temUserType_To_text(detailsData?.temUserType) }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="用户真实身份">{{ userIdentityFilter(detailsData?.userType) }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="昵称">{{ detailsData?.nickname || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="性别">{{ sex_to_text(detailsData?.sex) }}</nz-descriptions-item>

                <nz-descriptions-item nzTitle="生日">{{ detailsData?.birthday || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="地区">{{ geti4CityNameFilter() }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="最近登录时间" [nzSpan]="2">{{ detailsData?.lastLoginTime || '-' }}</nz-descriptions-item>

                <nz-descriptions-item nzTitle="上级用户ID">{{ accountInfos?.superiorId || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="绑定时间">{{ accountInfos?.bindingTime || '-' }}</nz-descriptions-item>
                <nz-descriptions-item nzTitle="成长值">
                    <span class="btn-blue" (click)="showGrowupModal()">
                        V{{ accountInfos?.growValueLevel }}
                        ({{ accountInfos?.growValue }})
                    </span>
                </nz-descriptions-item>
                <nz-descriptions-item nzTitle="粉丝" [nzSpan]="2">
                    <ng-container *ngIf="detailsData?.fansCount;else templateFans">
                        <span class="btn-blue" (click)="showFans()">{{ detailsData?.fansCount }}</span>
                    </ng-container>
                    <ng-template #templateFans>-</ng-template>
                </nz-descriptions-item>
            </nz-descriptions>
        </div>
    </div>
</nz-card>

<nz-card class="m-t-4" nzTitle="现金信息">
    <nz-descriptions
        [nzBordered]="false"
        nzSize="default"
        [nzColumn]="{ xxl: 5, xl: 4, lg: 4, md: 3, sm: 2, xs: 1 }">
        <nz-descriptions-item nzTitle="余额">{{ accountInfos.cashSubtract | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="待到账">{{ accountInfos.noArrivalCash | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="已到账">{{ accountInfos.arrivalCash | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="已失效">{{ accountInfos.invalidCash | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="爱思回收-推广分成">{{ accountInfos.aiSiRecoveryCash | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="游戏-推广分成">{{ accountInfos.gameDivideCash | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="爱思租机-推广分成">{{ accountInfos.rentMachine | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="爱思定制-推广分成">{{ accountInfos.adzCash | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="最近收益时间">{{ accountInfos.latelyTimeCash || '-' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="首次收益时间">{{ accountInfos.firstTimeCash || '-' }}</nz-descriptions-item>
    </nz-descriptions>
</nz-card>

<nz-card class="m-t-4" nzTitle="爱豆信息">
    <nz-descriptions
        [nzBordered]="false"
        nzSize="default"
        [nzColumn]="{ xxl: 5, xl: 4, lg: 4, md: 3, sm: 2, xs: 1 }">
        <nz-descriptions-item nzTitle="爱豆余额">{{ accountInfos?.subtract | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="待到账爱豆">{{ accountInfos?.noArrival | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="已到账爱豆">{{ accountInfos?.arrival | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="已失效爱豆">{{ accountInfos?.invalid | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="可兑换京东卡爱豆">{{ accountInfos?.exchangeJd | number: '0.2-2' }}</nz-descriptions-item>

        <nz-descriptions-item nzTitle="定制分成">{{ accountInfos?.customized | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="红包分成">{{ accountInfos?.redPacket | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="爱乐物-推广分成">{{ accountInfos?.extension | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="爱思助手-推广分成">{{ accountInfos?.aisi | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="游戏-推广分成">{{ accountInfos?.gameDivide | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="爱思回收-推广分成">{{ accountInfos?.aiSiRecovery | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="二手订单退还">{{ accountInfos?.secondOrderReturn | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="定制订单退还">{{ accountInfos?.ADZReturn | number: '0.2-2' }}</nz-descriptions-item>

        <nz-descriptions-item nzTitle="配件订单退还">{{ accountInfos?.orderReturn | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="红包退还">{{ accountInfos?.redPacketReturn | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="购买爱豆">{{ accountInfos?.purchaseArrival | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="活动奖励">{{ accountInfos?.activity | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="图纸会员退还">{{ accountInfos?.drawingReturn | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="充值专区退还">{{ accountInfos?.rechargeReturn | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="游戏消费">{{ accountInfos?.game | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="验机消费">{{ accountInfos?.testConsume | number: '0.2-2' }}</nz-descriptions-item>
        
        <nz-descriptions-item nzTitle="兑换京东卡">{{ accountInfos?.jd | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="二手订单消费">{{ accountInfos?.secondOrderConsume | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="配件订单消费">{{ accountInfos?.orderConsume | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="定制订单消费">{{ accountInfos?.ADZConsume | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="红包消费">{{ accountInfos?.redPacketConsume | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="图纸会员消费">{{ accountInfos?.drawingConsume | number: '0.2-2' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="充值专区消费">{{ accountInfos?.rechargeConsume | number: '0.2-2' }}</nz-descriptions-item>

        <nz-descriptions-item nzTitle="人工调整">
            <span *ngIf="accountInfos?.adjustment > 0">+</span>
            {{ accountInfos?.adjustment | number: '0.2-2' }}
        </nz-descriptions-item>

        <nz-descriptions-item nzTitle="最近收益时间">{{ accountInfos?.latelyTime || '-' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="首次收益时间">{{ accountInfos?.first || '-' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="最近兑换京东卡时间" nzSpan="3">{{ accountInfos?.latelyJdTime || '-' }}</nz-descriptions-item>
    </nz-descriptions>
</nz-card>

<nz-card class="m-t-4" nzTitle="验机分信息">
    <nz-descriptions
        [nzBordered]="false"
        nzSize="default"
        [nzColumn]="{ xxl: 5, xl: 4, lg: 4, md: 3, sm: 2, xs: 1 }">
        <nz-descriptions-item nzTitle="验机分余额">{{ detailsData?.machineInspectionDivide || '0' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="活动奖励">{{ detailsData?.activityReward || '0' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="已失效验机分">{{ detailsData?.overdueBranch || '0' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="已使用验机分">{{ detailsData?.machineInspectionConsume || '0' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="购买验机分">{{ detailsData?.machineInspectionRecharge || '0' }}</nz-descriptions-item>
        <nz-descriptions-item nzTitle="最近使用时间">{{ detailsData?.machineInspectionCreateTime || '-' }}</nz-descriptions-item>
    </nz-descriptions>
</nz-card>

<nz-card class="m-t-4">
    <div class="role-limit-wrap">
        <p class="role-limit-lf">
            <span class="limit-lf-title">用户权限管理</span>
            <button
                *ngIf="permission.userPermission.has('customer:manage:role')"
                nz-button
                nzType="link"
                (click)="showRoleModal()"
            >
                设置
            </button>
        </p>
        <p class="role-limit-rt">
            <nz-checkbox-group [(ngModel)]="roleExhibitionOptions" nzDisabled></nz-checkbox-group>
        </p>
    </div>
</nz-card>

<nz-card class="m-t-4">
    <button
        nz-button
        nzType="primary"
        class="m-r-10"
        (click)="addLabel(detailsData.id)">
        打标
    </button>
    <app-bt-group [btType]="'default'" [btText]="'返回'"></app-bt-group>
</nz-card>

<!-- S 粉丝 Modal -->
<fans-table-modal #fansModal [userId]="detailsData?.id"></fans-table-modal>
<!-- E 粉丝 Modal -->

<!-- S 成长值明细 Modal -->
<nz-modal
    [(nzVisible)]="isGrowupVisible"
    nzTitle="成长值明细"
    [nzWidth]="1000"
    [nzFooter]="null"
    (nzOnCancel)="isGrowupVisible = false">
    <ng-container *nzModalContent>
        <div class="table-wrap">
            <nz-table
                #growupTable
                nzSize="small"
                nzShowSizeChanger
                nzShowQuickJumper
                nzOuterBordered
                [nzFrontPagination]="false"
                [nzLoadingDelay]="100"
                [nzLoading]="tableParams.tableLoading"
                [nzData]="growupTableData"
                [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
                [nzTotal]="tableParams.total"
                [nzPageIndex]="tableParams.page"
                [nzPageSize]="tableParams.pageSize"
                [nzShowTotal]="totalTemplate"
                (nzPageIndexChange)="onPageIndexChange($event)"
                (nzPageSizeChange)="onPageSizeChange($event)"
            >
                <thead>
                    <tr>
                        <th nzAlign="center" nzWidth="100px">ID</th>
                        <th nzAlign="center">类型</th>
                        <th nzAlign="center">发生时间</th>
                        <th nzAlign="center">分值</th>
                        <th nzAlign="center">关联ID</th>
                    </tr>
                </thead>
      
                <tbody>
                    <tr *ngFor="let data of growupTable.data; let index = index;">
                        <td nzAlign="center">{{ data.id }}</td>
                        <td nzAlign="center">{{ growupTypeFilter(data.type) }}</td>
                        <td nzAlign="center">{{ data.createTime || '-' }}</td>
                        <td nzAlign="center">
                            <span [ngStyle]="{'color': data.growChange | scoreStatus: {type: 'color', changeType: data.changeType}}">
                                {{ data.growChange | scoreStatus: {type: 'text', changeType: data.changeType} }}
                            </span>
                        </td>
                        <td nzAlign="center">{{ data.businessId || '-' }}</td>
                    </tr>
                </tbody>
            </nz-table>
      
            <!-- 分页template -->
            <ng-template #totalTemplate let-total>共有 {{ tableParams.total }} 条</ng-template>
        </div>
    </ng-container>
</nz-modal>
<!-- E 成长值明细 Modal -->

<!-- S 权限管理 -->
<nz-modal
  nzClassName="custom-model-wrap"
  [nzFooter]="null"
  [(nzVisible)]="isRoleVisible"
  nzTitle="用户权限管理"
  (nzOnCancel)="isRoleVisible = false">

  <div *nzModalContent>
    <div class="custom-model-body">
        <nz-checkbox-wrapper>
            <div nz-row>
                <div
                    nz-col
                    nzSpan="24"
                    class="role-item p-b-20"
                    *ngFor="let option of roleOptions"
                >
                    <span class="role-title">{{ option.label }}:</span>
                    <label nz-checkbox [nzValue]="option.value" [(ngModel)]="option.checked">
                        <span class="role-tips">{{ option.tip }}</span>
                    </label>
                </div>
            </div>
        </nz-checkbox-wrapper>
    </div>

    <div class="custom-model-foot">
      <div class="custom-foot-cont">
        <button nz-button nzType="default" (click)="isRoleVisible = false">取消</button>
        <button nz-button nzType="primary" [nzLoading]="roleSubLoading" (click)="subRoleData()">确定</button>
      </div>
    </div>
  </div>
</nz-modal>
<!-- S 权限管理 -->